package com.wgj.android.ui.activity;

import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.RelativeLayout;

import com.jiaai.xui.utils.http.ListHttpCallBack;
import com.jiaai.xui.utils.http.XHttp;
import com.wgj.android.R;
import com.wgj.android.adapter.AdverAdapter;
import com.wgj.android.events.Adver;
import com.wgj.android.http.WGJAPI;
import com.wgj.android.utils.CacheUtils;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/1/19.
 */

public class ShareHaoBaoActivity extends AppCompatActivity {

    @BindView(R.id.layout1)
    RelativeLayout layout1;
    @BindView(R.id.layout2)
    RelativeLayout layout2;
    @BindView(R.id.layout3)
    RelativeLayout layout3;

    private ArrayList<Adver> advers = new ArrayList<>();

    private AdverAdapter adverAdApter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
       // XStatusBar.setTranslucent(this);
        super.setContentView(R.layout.share_haobao_activity);
        ButterKnife.bind(this);
        initView();
    }

    private void initView() {
        adverAdApter = new AdverAdapter(this);

    }

    private void getData() {
        XHttp.obtain().get(WGJAPI.BASEURL+"adver/findByAll?mId=2013" + CacheUtils.getMember().getM_id(), null, new ListHttpCallBack<Adver>() {
            @Override
            public void onSuccess(List<Adver> as) {
                if (as.size() > 0) {
                    adverAdApter.update(as);
                }
            }

            @Override
            public void onFailed(int i, String s, boolean b) {

            }
        });
    }
    @OnClick({R.id.layout1,R.id.layout2,R.id.layout3})
    public void onClick(View v){
        switch (v.getId()){
            case R.id.layout1:
                startActivity(new Intent(this, QDActivity.class));
                break;
            case R.id.layout2:
                startActivity(new Intent(this, GuanggaoActivity.class));
                break;
            case R.id.layout3:
                startActivity(new Intent(this, DonationHBActivity.class));
                break;
        }
    }

   /* @OnClick(R.id.tb_qdhistory)
    public void toQDHistory(View view) {
        startActivity(new Intent(this, QDActivity.class));
    }

    @OnClick(R.id.tb_back)
    public void back(View view) {
        finish();
    }

    @OnClick(R.id.tb_qd)
    public void onQDClick(View view) {
        XLoadingDialog.with(this).show();
        XHttp.obtain().get("http://192.168.1.117:8888/api/v1/admin/HB/takeSignHb?mId=" + CacheUtils.getMember().getM_id(), null, new HttpCallBack<String>() {
            @Override
            public void onSuccess(String s) {
                QDDialog.getInstael(true, s).show(getSupportFragmentManager(), "QDDialog");
                XLoadingDialog.with(ShareHaoBaoActivity.this).dismiss();
            }

            @Override
            public void onFailed(int i, String s, boolean b) {
                XLoadingDialog.with(ShareHaoBaoActivity.this).dismiss();
                QDDialog.getInstael(false, "").show(getSupportFragmentManager(), "QDDialog");

            }
        });

    }


    @OnClick(R.id.tb_hb)
    public void onHB(View view) {
        startActivity(new Intent(this, DonationHBActivity.class));
    }


    @Override
    public void onBackPressed() {
        if (JZVideoPlayer.backPress()) {
            return;
        }
        super.onBackPressed();
    }

    @Override
    protected void onPause() {
        super.onPause();
        JZVideoPlayer.releaseAllVideos();
    }*/
}
